<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/5/6
 * Time: 18:15
 */

require_once(__DIR__ . '/../vendor/autoload.php');


//$tesseract = new TesseractOCR();
//$tesseract->setImage('my-image.jpg')
//    ->setTempDir('./my-temp-dir');


$filename = 'captcha.png';


if(!is_file($filename)){
    $Client = new GuzzleHttp\Client();
    $data = $Client->request('GET', 'https://www.douban.com/misc/captcha?id=7ymqGtcMXXmD4VRqHAzjP1H5:en');

    $fp = fopen($filename, "w");
    fwrite($fp, $data->getBody()->getContents());
    fclose($fp);
}
$TesseractOCR = new TesseractOCR($filename);
var_dump($TesseractOCR->run());


echo "\n ???";


